package com.springboot.sba.utils;

import org.springframework.boot.autoconfigure.mail.MailProperties;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@RestControllerAdvice
public class ExceptionHandle {
    @ExceptionHandler(Exception.class)
    public Object exceptionHandle(Exception e, HttpServletRequest request) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("code", "11");
        map.put("msg", e.getMessage());
        map.put("url", String.valueOf(request.getRequestURL()));
        return map;

    }
}